An instant messaging technology is a communications technology that is developed based on the Internet and a mobile communications network. The technology can implement communication in a manner of a video, text, a short message, a voice message, or the like, and has enjoyed wide popularity among users. A voice intercom function is an important voice communication manner in the instant messaging technology. Based on the voice communication manner, a user may have a real-time voice chat, just like a text message chat, so that a requirement of a user for real-time communication is effectively satisfied, and the voice intercom function has found wide application in instant messaging on a mobile phone and other mobile terminals.
In an existing voice intercom technology, voice data is transmitted in a manner of an attachment. Specifically, a process of voice intercommunication between user B1 holding mobile terminal A1 and user B2 holding mobile terminal A2 is as follows: When user B1 sends a voice to user B2, after detecting that user B1 pushes a voice function button, mobile terminal A1 first collects the voice sent when user B1 pushes the button, and ends collection of a voice after detecting that the button is released, next, sequentially encodes and compresses the collected voice to obtain a voice file, and then sends the voice file to voice server C. After receiving the voice file, voice server C forwards the voice file to mobile terminal B1. Mobile terminal B1 sequentially decompresses and decodes the received voice file to obtain the voice, and plays the voice to user B2. Similarly, when user B2 sends a voice to user B1, a same processing manner is used. In this way, voice intercommunication between two mobile terminals may be implemented.
However, in the existing voice transmission process, collection, encoding, and compression of a voice are all completed to obtain an entire voice file and then the entire voice file is sent. Therefore, transmission of voice data requires a long time, resulting in low efficiency of transmission of voice data and undesirable real-time quality of voice transmission. Besides, during transmission of an entire voice file, in an environment of a mobile communications network or another wireless network, voice transmission often fails due to an unstable wireless network, and the entire voice file needs to be retransmitted after the voice transmission fails, which results in high consumption of network resources for retransmission of a voice file and further reduces efficiency of voice transmission and real-time quality of voice transmission. Therefore, a requirement for real-time quality of a voice in the voice intercom technology cannot be satisfied.